use time::OffsetDateTime;
// use mongodb::bson::{
// doc,
// serde_helpers::{chrono_datetime_as_bson_datetime, uuid_as_binary},
// };
// use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
use typed_builder::TypedBuilder;

use uuid::Uuid;
#[derive(Serialize, Deserialize, Debug, PartialEq, TypedBuilder)]
pub struct Post {
    #[serde(with = "uuid_as_binary")]
    id: Uuid,
    pub title: Option<String>,
    pub word_count: Option<i64>,
    pub real_url: String,
    pub alternative_url: Option<String>,
    // #[serde(with = "chrono_datetime_as_bson_datetime")]
    pub created: OffsetDateTime,
}

impl Post {
    pub fn id(&self) -> Uuid {
        self.id
    }
    pub fn title(&self) -> Option<String> {
        self.title.clone()
    }
    pub fn word_count(&self) -> Option<i64> {
        self.word_count
}
    pub fn real_url(&self) -> String {
        self.real_url.clone()
    }
    pub fn alternative_url(&self) -> Option<String> {
        self.alternative_url.clone()
    }
    pub fn created(&self) -> OffsetDateTime {
        self.created
    }
}
